import Vue from "vue"
import VueRouter from "vue-router"

// 引入组件

import login from '../page/login.vue'
import register from '../page/register.vue'
import guide from '../page/guide.vue'
import home from '../page/home.vue'
import notFound from '../page/404.vue'
import invoiceList from '../page/invoice/invoiceList.vue'
import invoiceDetail from '../page/invoice/invoiceDetail.vue'
import mailList from '../page/mail/mailList.vue'
import mailDetail from '../page/mail/mailDetail.vue'
import mine from '../page/mine/mine.vue'
import agreement from '../page/agreement.vue'
import test from '../page/test/test.vue'

// 要告诉 vue 使用 vueRouter
Vue.use(VueRouter);

let routes = [
  {
    path: "/",
    redirect: '/login',
    hidden: true
  },
  {
    path: '/login',
    component: login,
    name: 'login',
    hidden: true
  },
  {
    path: '/register',
    component: register,
    name: 'register',
    hidden: true
  },
  {
    path: '/guide',
    component: guide,
    name: 'guide',
    hidden: true
  },
  {
    path: '/404',
    component: notFound,
    name: 'notFound',
    hidden: true
  },
  {
    path: '/agreement/:type',
    component: agreement,
    name: 'agreement',
    hidden: true
  },
  {
    path: '/invoice',
    component: home,
    iconCls: 'el-icon-my-invoice', //图标样式class
    children: [
      {
        path: 'invoiceList',
        component: invoiceList,
        name: 'invoiceList',
        title: '发票列表',
        meta: {
          keepAlive: true
        }
      },
      {
        path: 'invoiceDetail',
        component: invoiceDetail,
        name: 'invoiceDetail',
        hidden: true,
        meta: {
          keepAlive: false
        }
      },
    ]
  },
  {
    path: '/mail',
    component: home,
    iconCls: 'el-icon-my-mailbox', //图标样式class
    children: [
      {
        path: 'mailList',
        component: mailList,
        name: 'mailList',
        title: '邮件列表',
        meta: {
          keepAlive: true
        }
      },
      {
        path: 'mailDetail',
        component: mailDetail,
        name: 'mailDetail',
        hidden: true,
        meta: {
          keepAlive: false
        }
      },
    ]
  },
  {
    path: '/mine',
    component: home,
    iconCls: 'el-icon-my-mine', //图标样式class
    children: [
      {
        path: 'mine',
        component: mine,
        name: 'mine',
        title: '个人资料',
        meta: {
          keepAlive: false
        }
      },
    ]
  },
  // {
  //   path: '/test',
  //   component: home,
  //   iconCls: 'el-icon-my-mine', //图标样式class
  //   children: [
  //     {
  //       path: 'test',
  //       component: test,
  //       name: '测试页面',
  //       meta: {
  //         keepAlive: false
  //       }
  //     }
  //   ]
  // },

];
var router = new VueRouter({
  mode: 'hash',
  base: '/invoice/web/index.html',
    routes
})
export default router;
